Pike Distribution on OSX

[ Start > PikeDevel > Pike Distribution on OSX ] [ Edit this Page | Show Page Versions | Show Formatted ]


This procedure a fresh install of pike with all non-Apple dependencies as static libraries, so that they don't have to be installed on each machine. 

~~Note~~: If you just care about installing Pike locally, homebrew has recipes for all of the dependencies you might need, as well as a (hopefully) up-to-date recipe for pike itself. There’s no need to follow this procedure if you can use homebrew… it’s a much quicker process: just do a  brew install pike. Also, the pkgsrc packaging system is available for OSX, and it generally does a better job of restricting package dependencies, and a pike build configuration is in final testing and will likely be available by the time you read this.

This process as-written also has a downside if you plan on installing external modules from source: The installed module build files will reference a bunch of paths from this build process, which likely won't exist on other machines, so you'd need to edit those files to correct the paths.

Dependencies included: gmp, nettle, jpeg, pcre, mariadb 

Additional library dependencies may be included, as long as they are compiled as static libs (and without shared libs) and installed into the devel-$SDKVER directory before Pike is built. Do not, for example, install any libraries through Homebrew or other package managers. 

Also, we're using the OSX 10.9 (Mavericks) SDK so that we can use the resulting Pike on any OSX machine running 10.9 and newer. 

~~Note~~: This process can be used for other OS/SDK version combinations.  

~~Note~~:  When using the 10.11 and 10.12 SDKs, the openssl headers and libs have been removed (they have been deprecated since 10.7). The OS still includes the dynamic libs, so to enable SSL support in the MariaDB/MySQL driver, you should copy /usr/lib/libssl* from the base OS and the headers from a configured copy of openssl 0.9.8z+ into the SDK and devel-10.12/include respectively. 

~~Note~~: Some of the download links have changed since this article was written. It's recommended that newer versions of the dependent libraries be used. On arm64 systems, this may be required.

1. Install fresh OSX 10.9 

2. Install Command line tools for Xcode from developer.apple.com (much smaller download) 

3. Install HomeBrew 

{code}
  /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
{code}

4. Turn off HomeBrew analytics 

{code}
  brew analytics off
{code}
 

5. Install wget and xz 

{code}
  brew install wget

  brew install xz

  brew install cmake
{code}

6. Make devel directory: 

{code}
  mkdir $HOME/devel

  cd $HOME/devel
{code}

7. Install MacOSX 10.9 SDK: 

{code}
  wget https://github.com/phracker/MacOSX-SDKs/releases/download/MacOSX10.11.sdk/MacOSX10.9.sdk.tar.xz

  xz -d MacOSX10.9.sdk.tar.xz

  tar -xvf MacOSX10.9.sdk.tar
{code}

8. Create a environment settings file for building Pike and its dependencies called pike_env: 

 {code}
  cat << EOF > $HOME/devel/pike_env 
  SDKVER=10.9 
  CPPFLAGS="-isysroot $HOME/devel/MacOSX$SDKVER.sdk -I$HOME/devel/devel-$SDKVER/include" 
  CFLAGS="$CPPFLAGS" 
  LDFLAGS="-L$HOME/devel/devel-$SDKVER/lib" 
  LDDFLAGS="$LDFLAGS" 
  MACOSX_DEPLOYMENT_TARGET=$SDKVER 
  PATH=$PATH:$HOME/devel/devel-$SDKVER/bin 
  LC_LOCALE=C 
  LOCALE=C 
  LC_ALL=C 
  export SDKVER CPPFLAGS CFLAGS LDFLAGS LDDFLAGS PATH MACOSX_DEPLOYMENT_TARGET 
  export LOCALE LC_ALL 
  EOF 
{code}

9. Source the pike environment into the shell: 
 
{code}
  . $HOME/devel/pike_env 
{code}
 
10. Download and install static gmp into SDK: 

{code}
  cd $HOME/devel 

  wget https://gmplib.org/download/gmp/gmp-5.1.3.tar.xz 

  xz -d gmp-5.1.3.tar.xz 

  tar xvf gmp-5.1.3.tar 

  cd gmp-5.1.3.tar 

  ./configure --with-pic --disable-shared --enable-static --prefix=$HOME/devel/devel-$SDKVER 

  make

  make install
{code}

01. Download and install static nettle into SDK: 

{code}
  cd $HOME/devel 

  wget https://ftp.gnu.org/gnu/nettle/nettle-3.3.tar.gz 

  tar zxvf nettle-3.3.tar.gz 

  cd nettle-3.3 

  ./configure --disable-shared --enable-static --prefix=$HOME/devel/devel-$SDKVER 

  make

  make install

{code}

12. Download and install static jpeglib into SDK: 

{code}
  cd $HOME/devel 

  wget http://www.ijg.org/files/jpegsrc.v8d.tar.gz 

  tar zxvf jpegsrc.v8d.tar.gz 

  cd jpeg-8d 

  ./configure --disable-shared --enable-static --disable-dependency-tracking --prefix=$HOME/devel/devel-$SDKVER 

  make

  make install
{code}

13. Download and install static pcre into SDK: 

{code}
  wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz

  tar xvf pcre-8.40.tar.gz

  cd pcre-8.40
 
  ./configure --disable-shared --enable-static --disable-dependency-tracking --enable-utf8 --enable-pcre8 --enable-pcre16 --enable-pcre32 --enable-unicode-properties --enable-jit --prefix=$HOME/devel/devel-$SDKVER 

  make

  make install
{code}

14. Download and install mariadb-connector-c into SDK: 

{code}
  wget https://downloads.mariadb.org/interstitial/connector-c-2.3.2/mariadb-connector-c-2.3.2-src.tar.gz/from/http%3A//sfo1.mirrors.digitalocean.com/mariadb/ 

  tar xzvf mariadb-connector-c-2.3.2-src.tar.gz 

  cd mariadb-connector-c-2.3.2-src 

  cmake -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_INSTALL_PREFIX:PATH=$HOME/devel/devel-$SDKVER .

  make all install

  cp mariadb_config/mariadb_config /usr/local/bin

  rm $HOME/devel/devel-$SDKVER/lib/mariadb/*.dylib
{code}

15. Download and install free type into SDK 

{code}
  cd $HOME/devel

  wget http://download.savannah.gnu.org/releases/freetype/freetype-2.5.5.tar.gz

  tar xzvf freetype-2.5.5.tar.gz

  cd freetype-2.5.5

  ./configure --disable-shared --enable-static --disable-dependency-tracking --prefix=$HOME/devel/devel-$SDKVER

  make

  make install
{code}

~~Note~: $HOME/devel/devel-$SDKVER/bin/freetype2-config  needs to be modified so that it returns the static lib options as the pike configure script doesn’t include the —static option. 

16. Download and package Pike: 

{code}
  cd $HOME/devel 

  wget http://pike.lysator.liu.se/pub/pike/latest-stable/Pike-v8.0.404.tar.gz 

  tar zxvf Pike-v8.0.404.tar.gz

  cd Pike-v8.0.404

  make

  make verify

  make bin_export

  cd build/darwin-14.5.0-x86_64
{code}

17. Pike installer is located in build directory: 

{code}
  ls -l Pike-v8.0.404-darwin-14.5.0-x86_64
{code}

Powered by PikeWiki2

 
gotpike.org | Copyright © 2004 - 2009 | Pike is a trademark of Department of Computer and Information Science, Linköping University